<?php

#define('_IMAGEMAGICK_BINDIR','/usr/bin');
define('_IMAGEMAGICK_BINDIR',"");
define('_FONTS_DIR',XOOPS_ROOT_PATH."/modules/neosystem/fonts");
class promSecureLabel{

var $modulename;
var $fontname='rdo.ttf';
function promSecureLabel($modulename){
$this->modulename=$modulename;
}
function initialize(){
list($usec, $sec) = explode(' ', microtime());
    $rseed =  (float) $sec + ((float) $usec * 100000);
	srand($rseed);
	$randval = rand();
	$uniq = uniqid('',true);
	#echo $uniq;
	$temparr = split("\.",$uniq);
	$rand = $temparr[1];
	$rand = substr($rand,1,4);
	
	$_SESSION[$this->modulename]['author_id']=$rand;
	#print_r($_SESSION);
	
}

function isAuthority($author_id){
return ($author_id==$_SESSION[$this->modulename]['author_id']);

}

function getAuthorId(){
#print_r($_SESSION);
return $_SESSION[$this->modulename]['author_id'];
}

function display(){
	#echo $this->getAuthorId();
    $align="-gravity center";
   $xpos=0;
   $ypos=0;
   $fontname = "-font \""._FONTS_DIR."/".$this->fontname."\"";
 # $command=_IMAGEMAGICK_BINDIR."/convert  $align $fontname $fontsize $color -draw \"text $xpos,$ypos '".$_SESSION['board']['secure']."'\"  $srcfile 'png:-'";
   $command = _IMAGEMAGICK_BINDIR."convert -size 88x30 xc:white $align $fontname $fontsize $color -draw \"text $xpos,$ypos '".$this->getAuthorId()."'\" \"png:-\"";
#echo $command;

   header("Content-type: image/png");
   passthru("$command 2>&1");

}
}

?>